<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Kalkulaator</title>



<script language="javascript" type="text/javascript">  

function calculate(num){
	a=Number(document.calc.firstnumber.value);  
	b=Number(document.calc.lastnumber.value);
	switch(num)
	{
	case 0:
		c=a+b;
		document.calc.answer.value = c;
		break;
	case 1:
		c=a-b;
		document.calc.answer.value = c;
		break;
	case 2:
		c=a*b;
		document.calc.answer.value = c;
		break;
	case 3:
		c=a/b;
		document.calc.answer.value = c;
		break;
	}

}

</script> 


</head>
<body>
<form name="calc">

<input type="text" name="firstnumber" size="4"/>

<select name="signs" id="signs">
	<option value="add">+</option>
	<option value="subtract">-</option>
	<option value="multiply">*</option>
	<option value="divide">/</option>
</select>	
<input type="text" name="lastnumber" size="4" />
=
<input type="text" name="answer" size="4" />
<button type="button" onclick="javascript:calculate(document.calc.signs.selectedIndex);">Arvuta</button>



</form> 

</body>
</html>